<html>
<head><meta charset="utf-8"><title>itertools::izip doesnt work for RA properly · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/itertools.3A.3Aizip.20doesnt.20work.20for.20RA.20properly.html">itertools::izip doesnt work for RA properly</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="245949931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/itertools%3A%3Aizip%20doesnt%20work%20for%20RA%20properly/near/245949931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/itertools.3A.3Aizip.20doesnt.20work.20for.20RA.20properly.html#245949931">(Jul 14 2021 at 12:00)</a>:</h4>
<p>Does our macro expansion not make use of hygiene yet or is the following a bug(I assume this is a hygiene issue might be something else)?<br>
Basically:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">izip</span><span class="o">!</span><span class="p">(</span><span class="n">params</span><span class="p">,</span><span class="w"> </span><span class="n">param_use_nodes</span><span class="p">,</span><span class="w"> </span><span class="n">arg_list</span><span class="p">)</span><span class="w"></span>
</code></pre></div>
<p>expands to(in RA and playground)</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code>::<span class="n">itertools</span>::<span class="n">__std_iter</span>::<span class="nb">IntoIterator</span>::<span class="n">into_iter</span><span class="p">(</span><span class="n">params</span><span class="p">)</span><span class="w"></span>
<span class="w">                    </span><span class="p">.</span><span class="n">zip</span><span class="p">(</span><span class="n">param_use_nodes</span><span class="p">)</span><span class="w"></span>
<span class="w">                    </span><span class="p">.</span><span class="n">zip</span><span class="p">(</span><span class="n">arg_list</span><span class="p">)</span><span class="w"></span>
<span class="w">                    </span><span class="p">.</span><span class="n">map</span><span class="p">(</span><span class="o">|</span><span class="p">((</span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">),</span><span class="w"> </span><span class="n">b</span><span class="p">)</span><span class="o">|</span><span class="w"> </span><span class="p">(</span><span class="n">a</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">,</span><span class="w"> </span><span class="n">b</span><span class="p">))</span><span class="w"></span>
</code></pre></div>
<p>just fine, note the double use of <code>b</code>.</p>
<p>But we don't seem to generate typehints for this in <code>for ((pat, param_ty, _), usages, expr) in izip!(params, param_use_nodes, arg_list).rev()</code> here. Which I assume might be hygiene related?</p>
<p><a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/inline_call.rs#L160">https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide_assists/src/handlers/inline_call.rs#L160</a><br>
izip def: <a href="https://docs.rs/itertools/0.10.1/src/itertools/lib.rs.html#315-349">https://docs.rs/itertools/0.10.1/src/itertools/lib.rs.html#315-349</a></p>



<a name="245950159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/itertools%3A%3Aizip%20doesnt%20work%20for%20RA%20properly/near/245950159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/itertools.3A.3Aizip.20doesnt.20work.20for.20RA.20properly.html#245950159">(Jul 14 2021 at 12:02)</a>:</h4>
<p>yeah, we don't support hygiene for local bindings at the moment</p>



<a name="245950190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/itertools%3A%3Aizip%20doesnt%20work%20for%20RA%20properly/near/245950190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/itertools.3A.3Aizip.20doesnt.20work.20for.20RA.20properly.html#245950190">(Jul 14 2021 at 12:02)</a>:</h4>
<p><span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>